home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DllSys_Files / CONTAXON / BKINTEGA.C < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.7 KB  |  49 lines

  1. // Dynamic link library implementation of NeuroSolutions BackIntegratorAxon component 
  2.  
  3. #include "NSDLL.h"
  4.  
  5. /********************************/
  6. /* Backpropagation of component */
  7.  
  8. __declspec(dllexport) void performBackContextAxon(
  9.     DLLData *instance,    // Pointer to instance data (may be NULL)
  10.     DLLData *dualInstance,    // Pointer to the forward axons instance data (may be NULL)
  11.     NSFloat    *error,     // Pointer to the current error vector
  12.     int     rows,        // Number of rows of PEs in the layer
  13.     int     cols,        // Number of columns of PEs in the layer
  14.     NSFloat    *delayedError,     // Pointer to the last error vector (delayed by one time step)
  15.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  16.     NSFloat    *tau,        // Pointer to a vector of time constants, one for each PE
  17.     NSFloat    beta,        // Linear scaling factor controlled within the components inspector
  18.     NSFloat    *gradient     // Pointer to the tau gradient vector
  19.     )
  20.     
  21. {
  22.     int i, length=rows*cols;
  23.  
  24.     for (i=0; i<length; i++) {
  25.         error[i] = beta*((1.0f-tau[i])*data[i] + tau[i]*delayedError[i]);
  26.         if (gradient)
  27.             gradient[i] += delayedError[i]*beta*data[i];
  28.     } 
  29. }
  30.  
  31. /******************************************/
  32. /* Management of instance data (OPTIONAL) */
  33. /*
  34. __declspec(dllexport) DLLData *allocBackContextAxon(
  35.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  36.     DLLData    *dualInstance,    // Pointer to forward axonÆs instance data (may be NULL)
  37.     int     rows,        // Number of rows of PEs in the layer
  38.     int     cols        // Number of columns of PEs in the layer
  39.     )
  40. {
  41.     DLLData *instance = allocDLLInstance(oldInstance);
  42.     return instance;
  43. }
  44.  
  45. __declspec(dllexport) void freeBackContextAxon(DLLData *instance)
  46. {
  47.     freeDLLInstance(instance);
  48. }
  49. */